<template>
	<view class="coma-container">
		<text class="coma-title">子组件A</text>
		<view class="coma-content">
			<text class="coma-label">父组件传进来的值:</text>
			<text class="coma-value">{{ intent }}</text>
		</view>
		<button class="coma-btn" type="primary" @click="sendData()">传值给ComB组件</button>
	</view>
</template>

<script>
export default {
	name: "ComA",
	props: ['intent'], // 接收父组件传递的值
	data() {
		return {};
	},
	methods: {
		sendData() {
			console.warn("----ComA----sendData---->" + this.intent);
			// 修正：uni.$emit 而非 uni.$semit（拼写错误）
			uni.$emit('getIntent', this.intent);
		}
	}
}
</script>

<style scoped>
.coma-container {
	padding: 20rpx;
	background-color: #f5fafe;
	border-radius: 16rpx;
	margin: 20rpx;
	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.coma-title {
	font-size: 32rpx;
	font-weight: 600;
	color: #2d3748;
	margin-bottom: 20rpx;
	display: block;
}
.coma-content {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 24rpx;
}
.coma-label {
	font-size: 28rpx;
	color: #4a5568;
	margin-right: 12rpx;
}
.coma-value {
	font-size: 28rpx;
	font-weight: bold;
	color: #e53e3e;
	padding: 8rpx 16rpx;
	background-color: #fff;
	border-radius: 8rpx;
	border: 1px solid #fee2e2;
}
.coma-btn {
	width: 100%;
	height: 80rpx;
	font-size: 28rpx;
	border-radius: 12rpx;
}
</style>